gtk_action_bar_allocate,
NULL,
NULL,
+ NULL,
NULL);
}
gtk_button_box_allocate,
NULL,
NULL,
+ NULL,
NULL);
}
gtk_box_allocate_contents,
NULL,
NULL,
+ NULL,
NULL);
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (box));
gtk_button_allocate,
NULL,
NULL,
+ NULL,
NULL);
}
gtk_cell_view_allocate,
gtk_cell_view_render,
NULL,
+ NULL,
NULL);
}
NULL,
gtk_color_swatch_render,
NULL,
+ NULL,
NULL);
gtk_css_gadget_add_class (swatch->priv->gadget, "activatable");
gtk_combo_box_measure,
gtk_combo_box_allocate,
NULL,
+ NULL,
NULL, NULL);
}
* Typically, GtkCssDrawFunc will draw sub-gadgets and child widgets
* that are placed relative to the gadget, as well as custom content
* such as icons, checkmarks, arrows or text.
+ *
+ * GtkCssSnapshotFunc:
+ * @gadget: the #GtkCssCustomGadget
+ * @snapshot: the snapshot to snapshot to
+ * @x: the x origin of the content area
+ * @y: the y origin of the content area
+ * @width: the width of the content area
+ * @height: the height of the content area
+ * @data: data provided when registering the callback
+ *
+ * The GtkCssSnapshotFunc is called to snapshot the gadget's content in
+ * gtk_css_gadget_snapshot(). It gets passed an untransformed cairo context
+ * and the coordinates of the area to draw the content in.
+ *
+ * Typically, GtkCssSnapshotFunc will draw sub-gadgets and child widgets
+ * that are placed relative to the gadget, as well as custom content
+ * such as icons, checkmarks, arrows or text.
*/
typedef struct _GtkCssCustomGadgetPrivate GtkCssCustomGadgetPrivate;
GtkCssPreferredSizeFunc preferred_size_func;
GtkCssAllocateFunc allocate_func;
GtkCssDrawFunc draw_func;
+ GtkCssSnapshotFunc snapshot_func;
gpointer data;
GDestroyNotify destroy_func;
};
return GTK_CSS_GADGET_CLASS (gtk_css_custom_gadget_parent_class)->draw (gadget, cr, x, y, width, height);
}
+static gboolean
+gtk_css_custom_gadget_snapshot (GtkCssGadget *gadget,
+ GtkSnapshot *snapshot,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ GtkCssCustomGadgetPrivate *priv = gtk_css_custom_gadget_get_instance_private (GTK_CSS_CUSTOM_GADGET (gadget));
+
+ if (priv->snapshot_func)
+ return priv->snapshot_func (gadget, snapshot, x, y, width, height, priv->data);
+ else if (priv->draw_func)
+ return GTK_CSS_GADGET_CLASS (gtk_css_custom_gadget_parent_class)->snapshot (gadget, snapshot, x, y, width, height);
+ else
+ return FALSE;
+}
+
static gboolean
gtk_css_custom_gadget_has_content (GtkCssGadget *gadget)
{
gadget_class->get_preferred_size = gtk_css_custom_gadget_get_preferred_size;
gadget_class->allocate = gtk_css_custom_gadget_allocate;
gadget_class->draw = gtk_css_custom_gadget_draw;
+ gadget_class->snapshot = gtk_css_custom_gadget_snapshot;
gadget_class->has_content = gtk_css_custom_gadget_has_content;
}
* @preferred_size_func: (nullable): the GtkCssPreferredSizeFunc to use
* @allocate_func: (nullable): the GtkCssAllocateFunc to use
* @draw_func: (nullable): the GtkCssDrawFunc to use
+ * @snapshot_func: (nullable): the GtkCssSnapshotFunc to use
* @data: (nullable): user data to pass to the callbacks
* @destroy_func: (nullable): destroy notify for @data
*
GtkCssPreferredSizeFunc preferred_size_func,
GtkCssAllocateFunc allocate_func,
GtkCssDrawFunc draw_func,
+ GtkCssSnapshotFunc snapshot_func,
gpointer data,
GDestroyNotify destroy_func)
{
priv->preferred_size_func = preferred_size_func;
priv->allocate_func = allocate_func;
priv->draw_func = draw_func;
+ priv->snapshot_func = snapshot_func;
priv->data = data;
priv->destroy_func = destroy_func;
* @preferred_size_func: (nullable): the GtkCssPreferredSizeFunc to use
* @allocate_func: (nullable): the GtkCssAllocateFunc to use
* @draw_func: (nullable): the GtkCssDrawFunc to use
+ * @snapshot_func: (nullable): the GtkCssSnapshotFunc to use
* @data: (nullable): user data to pass to the callbacks
* @destroy_func: (nullable): destroy notify for @data
*
GtkCssPreferredSizeFunc preferred_size_func,
GtkCssAllocateFunc allocate_func,
GtkCssDrawFunc draw_func,
+ GtkCssSnapshotFunc snapshot_func,
gpointer data,
GDestroyNotify destroy_func)
{
preferred_size_func,
allocate_func,
draw_func,
+ snapshot_func,
data,
destroy_func);
int width,
int height,
gpointer data);
+typedef gboolean (* GtkCssSnapshotFunc) (GtkCssGadget *gadget,
+ GtkSnapshot *snapshot,
+ int x,
+ int y,
+ int width,
+ int height,
+ gpointer data);
struct _GtkCssCustomGadget
{
GtkCssGadget parent;
GtkCssPreferredSizeFunc get_preferred_size_func,
GtkCssAllocateFunc allocate_func,
GtkCssDrawFunc draw_func,
+ GtkCssSnapshotFunc snapshot_func,
gpointer data,
GDestroyNotify destroy_func);
GtkCssGadget * gtk_css_custom_gadget_new_for_node (GtkCssNode *node,
GtkCssPreferredSizeFunc preferred_size_func,
GtkCssAllocateFunc allocate_func,
GtkCssDrawFunc draw_func,
+ GtkCssSnapshotFunc snapshot_func,
gpointer data,
GDestroyNotify destroy_func);
gtk_entry_allocate,
gtk_entry_render,
NULL,
+ NULL,
NULL);
for (i = 0; i < 2; i++)
NULL,
NULL,
NULL,
+ NULL,
NULL);
gtk_css_gadget_set_state (priv->progress_gadget,
gtk_css_node_get_state (gtk_widget_get_css_node (GTK_WIDGET (entry))));
gtk_flow_box_child_allocate,
NULL,
NULL,
+ NULL,
NULL);
}
gtk_flow_box_allocate,
NULL,
NULL,
+ NULL,
NULL);
}
gtk_frame_allocate,
NULL,
NULL,
+ NULL,
NULL);
priv->border_gadget = gtk_css_custom_gadget_new ("border",
- GTK_WIDGET (frame),
- priv->gadget,
- NULL,
- gtk_frame_measure_border,
- gtk_frame_allocate_border,
- NULL,
- NULL,
- NULL);
+ GTK_WIDGET (frame),
+ priv->gadget,
+ NULL,
+ gtk_frame_measure_border,
+ gtk_frame_allocate_border,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
gtk_css_gadget_set_state (priv->border_gadget, gtk_widget_get_state_flags (GTK_WIDGET (frame)));
}
gtk_grid_allocate,
NULL,
NULL,
+ NULL,
NULL);
gtk_header_bar_allocate_contents,
NULL,
NULL,
+ NULL,
NULL);
}
gtk_image_get_content_size,
NULL,
NULL,
+ NULL,
NULL, NULL);
}
NULL,
NULL,
NULL,
+ NULL,
NULL);
}
GTK_WIDGET (self),
priv->trough_gadget,
NULL,
+ NULL,
NULL, NULL, NULL,
NULL, NULL);
gtk_css_gadget_set_state (priv->block_gadget[i], gtk_css_node_get_state (trough_node));
gtk_level_bar_measure_trough,
gtk_level_bar_allocate_trough,
gtk_level_bar_render_trough,
+ NULL,
NULL, NULL);
trough_node = gtk_css_gadget_get_node (priv->trough_gadget);
gtk_css_node_set_parent (trough_node, widget_node);
gtk_list_box_allocate,
NULL,
NULL,
+ NULL,
NULL);
}
gtk_list_box_row_allocate,
NULL,
NULL,
+ NULL,
NULL);
gtk_css_gadget_add_class (ROW_PRIV (row)->gadget, "activatable");
}
gtk_menu_bar_measure,
gtk_menu_bar_allocate,
gtk_menu_bar_render,
+ NULL,
NULL, NULL);
}
gtk_menu_item_measure,
gtk_menu_item_allocate,
gtk_menu_item_render,
+ NULL,
NULL, NULL);
}
gtk_model_button_allocate,
NULL,
NULL,
+ NULL,
NULL);
button->indicator_gadget = gtk_builtin_icon_new ("check",
GTK_WIDGET (button),
gtk_notebook_allocate_stack,
gtk_notebook_draw_stack,
NULL,
+ NULL,
NULL);
gtk_css_gadget_set_state (priv->stack_gadget, gtk_css_node_get_state (widget_node));
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), -1, priv->stack_gadget, TRUE, GTK_ALIGN_FILL);
gtk_notebook_allocate_tabs,
gtk_notebook_draw_tabs,
NULL,
+ NULL,
NULL);
gtk_css_gadget_set_state (priv->tabs_gadget, gtk_css_node_get_state (widget_node));
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->header_gadget), 0, priv->tabs_gadget, TRUE, GTK_ALIGN_FILL);
measure_tab,
allocate_tab,
draw_tab,
+ NULL,
page,
NULL);
if (priv->tabs_reversed)
gtk_paned_allocate,
NULL,
NULL,
+ NULL,
NULL);
priv->handle_gadget = gtk_css_custom_gadget_new ("separator",
GTK_WIDGET (paned),
NULL,
NULL,
NULL,
+ NULL,
NULL);
update_node_state (GTK_WIDGET (paned));
}
gtk_progress_bar_allocate,
gtk_progress_bar_render,
NULL,
+ NULL,
NULL);
priv->trough_gadget = gtk_css_custom_gadget_new ("trough",
gtk_progress_bar_allocate_trough,
gtk_progress_bar_render_trough,
NULL,
+ NULL,
NULL);
priv->progress_gadget = gtk_css_custom_gadget_new ("progress",
NULL,
NULL,
NULL,
+ NULL,
NULL);
update_node_state (pbar);
NULL,
gtk_progress_bar_render_text,
NULL,
+ NULL,
NULL);
g_signal_connect (gtk_css_gadget_get_node (priv->text_gadget), "style-changed",
G_CALLBACK (gtk_progress_bar_text_style_changed), pbar);
gtk_range_measure,
gtk_range_allocate,
gtk_range_render,
+ NULL,
NULL, NULL);
priv->contents_gadget = gtk_box_gadget_new ("contents",
GTK_WIDGET (range),
gtk_range_measure_trough,
gtk_range_allocate_trough,
gtk_range_render_trough,
+ NULL,
NULL, NULL);
gtk_css_gadget_set_state (priv->trough_gadget,
gtk_css_node_get_state (widget_node));
GTK_WIDGET (range),
priv->trough_gadget, NULL,
NULL, NULL, NULL,
+ NULL,
NULL, NULL);
gtk_css_gadget_set_state (priv->fill_gadget,
gtk_css_node_get_state (gtk_css_gadget_get_node (priv->trough_gadget)));
GTK_WIDGET (range),
priv->trough_gadget, NULL,
NULL, NULL, NULL,
+ NULL,
NULL, NULL);
gtk_css_gadget_set_state (priv->highlight_gadget,
gtk_css_node_get_state (gtk_css_gadget_get_node (priv->trough_gadget)));
gtk_scale_measure_value,
NULL,
gtk_scale_render_value,
+ NULL,
NULL, NULL);
g_signal_connect (gtk_css_gadget_get_node (priv->value_gadget), "style-changed",
G_CALLBACK (gtk_scale_value_style_changed), scale);
gtk_scale_measure_marks,
gtk_scale_allocate_marks,
gtk_scale_render_marks,
+ NULL,
NULL, NULL);
gtk_css_node_insert_after (widget_node,
gtk_css_gadget_get_node (priv->top_marks_gadget),
gtk_scale_measure_marks,
gtk_scale_allocate_marks,
gtk_scale_render_marks,
+ NULL,
NULL, NULL);
gtk_css_node_insert_before (widget_node,
gtk_css_gadget_get_node (priv->bottom_marks_gadget),
gtk_scale_measure_mark,
gtk_scale_allocate_mark,
gtk_scale_render_mark,
+ NULL,
mark, NULL);
gtk_css_gadget_set_state (mark->gadget, gtk_css_node_get_state (marks_node));
NULL,
NULL,
gtk_scale_render_mark_indicator,
+ NULL,
mark, NULL);
if (mark->markup && *mark->markup)
{
gtk_scale_measure_mark_label,
NULL,
gtk_scale_render_mark_label,
+ NULL,
mark, NULL);
g_signal_connect (gtk_css_gadget_get_node (mark->label_gadget), "style-changed",
G_CALLBACK (gtk_scale_mark_style_changed), mark);
gtk_scrolled_window_measure,
gtk_scrolled_window_allocate,
gtk_scrolled_window_render,
+ NULL,
NULL, NULL);
for (i = 0; i < 4; i++)
{
separator->priv->gadget = gtk_css_custom_gadget_new_for_node (widget_node,
GTK_WIDGET (separator),
NULL, NULL, NULL,
+ NULL,
NULL, NULL);
}
gtk_css_custom_gadget_new_for_node (widget_node,
widget,
NULL, NULL, NULL,
+ NULL,
NULL, NULL);
}
gtk_stack_allocate,
gtk_stack_render,
NULL,
+ NULL,
NULL);
}
gtk_switch_allocate_contents,
gtk_switch_render_trough,
NULL,
+ NULL,
NULL);
priv->slider_gadget = gtk_css_custom_gadget_new ("slider",
NULL,
gtk_switch_render_slider,
NULL,
+ NULL,
NULL);
gesture = gtk_gesture_multi_press_new (GTK_WIDGET (self));
gtk_toolbar_measure,
gtk_toolbar_allocate,
gtk_toolbar_render,
+ NULL,
NULL, NULL);
priv->arrow_button = gtk_toggle_button_new ();
gtk_viewport_measure,
gtk_viewport_allocate,
gtk_viewport_render,
+ NULL,
NULL, NULL);
gtk_css_gadget_add_class (priv->gadget, GTK_STYLE_CLASS_FRAME);